﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Linq.Expressions;

namespace Htse.Blue.Helpers
{
	public class DataGridColumn<T>
	{
		public MemberExpression Expression { get; private set; }

		public string Name { get; private set; }

		public int? Width { get; private set; }

		public bool AllowSorting { get; private set; }

		public DataGridColumn(Expression<Func<T, object>> value, string name, bool allowSorting, int? width)
		{
			Name = name;
			var exp = value.GetMemberExpression();
			Expression = exp;
			AllowSorting = allowSorting;
			Width = width;
		}

		public DataGridColumn(Expression<Func<T, object>> value, string name, bool allowSorting)
			: this(value, name, allowSorting, null)
		{
		}

		public DataGridColumn(Expression<Func<T, object>> value, string name, int? width)
			: this(value, name, false, width)
		{
		}

		public DataGridColumn(Expression<Func<T, object>> value, string name)
			: this(value, name, false, null)
		{
		}
	}
}
